<!doctype html>
<html lang="zh_cn" itemscope itemtype="http://schema.org/Person">
<head>
            <meta charset="utf-8">
        <!-- Site Meta Data -->
        <title>Pelican静态博客引入评论模块Coding-Comments</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="技术博客,涉及Java/PHP/Python/Javascript等,聊聊程序,聊聊生活,聊聊事实,聊聊育儿">
        <meta name="keywords" content="编码经验,技术分享,生活积累,实事评说">
        <meta name="author" content="布丁缘">

        <link rel="shortcut icon" href="">

        <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>
        <!-- Style Meta Data -->
        <link rel="stylesheet" href="https://www.ddkiss.com/theme/css/style.css" type="text/css"/>
        <link rel="stylesheet" href="https://www.ddkiss.com/theme/css/pygments.css" type="text/css"/>

        <!-- Feed Meta Data -->
            <link href="https://www.ddkiss.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate"
                  title="一个程序员的简单生活 ATOM Feed"/>


    <meta name="keywords" content="Coding-Comments,Pelican">
    <link rel="stylesheet" href="//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.1.0/default.css">
</head>

<body>
<!-- Sidebar -->
<aside>
    <center><h1><a href="/" style="color:#fff"><img id="avatar" src="/images/avatar.jpg"></a></h1></center>
        <p>一个程序员的简单生活</p>
    <br>
    <nav class="nav">
        <ul class="list-bare">
                <li><a class="nav__link" href="https://www.ddkiss.com/category/chang-yong-ji-qiao.html">常用技巧</a></li>
                <li><a class="nav__link" href="https://www.ddkiss.com/category/kai-fa-huan-jing.html">开发环境</a></li>
                <li><a class="nav__link" href="https://www.ddkiss.com/category/sheng-huo-dian-di.html">生活点滴</a></li>

                <li><a class="nav__link" href="/pages/books.html">书单</a></li>
                <li><a class="nav__link" href="/pages/movies.html">影单</a></li>
                <li><a class="nav__link" href="/pages/downloads.html">下载</a></li>
                <li><a class="nav__link" href="/pages/about.html">关于我</a></li>


        </ul>
    </nav>


    <form>
      <input type="text"  id="bdcsMain"/>
    </form>

</aside>

<!-- Content -->
<article>
  <main>
    <nav>
      <a href="/">首页</a>
      <a href="/archives.html">归档</a>
      <a href="/categories.html">分类</a>
      <a href="/tags.html">标签</a>
      <a href="/pages/about.html">关于我</a>
    </nav>
  </main>
    <section id="content">
        <article>
            <h2 class="post_title post_detail"><a href="https://www.ddkiss.com/archives/74.html" rel="bookmark"
                                                  title="Permalink to Pelican静态博客引入评论模块Coding-Comments">Pelican静态博客引入评论模块Coding-Comments</a></h2>

            <div class="post_list">
                <span>作者：</span><a href="https://www.ddkiss.com/author/bu-ding-yuan.html">布丁缘</a>
                <span class="post_category">分类：<a href="https://www.ddkiss.com/category/kai-fa-huan-jing.html" rel="bookmark"
                                               title="Permalink to 开发环境">开发环境</a></span>
                <span class="post_date">  时间：2017-10-27 18:00:00</span>

            </div>
            <div class="entry-content blog-post">
                <p>本来不想装评论模块，偶然看到大家都在聊<strong>多说</strong>关闭了，进去看了下。至于原因？现在QQ群主都要对自己群内成员说的话好好看看了，所以瞎评论的东东很难活呀。有需求就有人看到了商机。有人用github账户互联的，不过怕不稳定，算了。还是用国内的Coding-Comments。毕竟真正要留言的人也不在乎注册登录下,试用了下，也很简单，支持腾讯云(微信/QQ)。遗憾的是不支持微博……下面简述下整合过程。参考<a href="https://coding.net/u/coding/p/Comments/git/blob/master/docs/manual.md">这里</a>。</p>
<h2>主要步骤</h2>
<h3>1.注册Coding账户</h3>
<p>地址：<a href="https://coding.net/">coding官网</a> 。个人一直除了用github，就是用oschina的'码云'。其他的用得少，注册一个也无大碍吧，反正免费，你说呢。</p>
<h3>2.新建一个公开的项目</h3>
<p>新建一个<strong>公开</strong>的项目，啥都不用上传，就空的就行！</p>
<h3>3. 添加应用</h3>
<p>账户－应用管理－添加应用。特别注意必须填写'回调地址',认证时会校验的。然后就得到了client_id和client_secret</p>
<h3>4. 修改模板</h3>
<p>打开<code>templates/article.html</code>，在header里引入样式</p>
<div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">block</span> <span class="nv">head</span> <span class="cp">%}</span><span class="x"></span>
<span class="x">    </span><span class="cp">{{</span> <span class="nb">super</span><span class="o">()</span> <span class="cp">}}</span><span class="x"></span>
<span class="x">    &lt;link rel=&quot;stylesheet&quot; href=&quot;//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.1.0/default.css&quot;&gt;</span>
<span class="cp">{%</span> <span class="k">endblock</span> <span class="nv">head</span> <span class="cp">%}</span><span class="x"></span>
</pre></div>


<p>然后在<code>&lt;article&gt;</code>标签尾部加入评论代码，比如我的</p>
<div class="highlight"><pre><span></span><span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;container&quot;</span><span class="nt">&gt;&lt;/div&gt;</span>
<span class="nt">&lt;script</span> <span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.1.0/gitment.min.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
<span class="nt">&lt;script&gt;</span>
    var gitment = new Gitment({
      owner: &#39;whusl&#39;,
      repo: &#39;BlogComments&#39;,
      oauth: {
        client_id: &#39;621866266817529fba46681653017809&#39;,
        client_secret: &#39;14188411740b12ae52159cee9b586bf85cd54125&#39;,
      },
    })
    document.getElementById(&#39;container&#39;).appendChild(gitment.render())
  <span class="nt">&lt;/script&gt;</span>
</pre></div>


<h3>5. 发布页面</h3>
<p>因为认证绑定的地址是线上的，所以必须到线上查看是否成功。如果出现'Error: 等待主人初始化讨论'，则需要点击右边登录按钮，点击'初始化讨论'按钮。为了得到url作为评论的Key,所以需要自己点击下，OMG，也只能这样了。</p>
<h2>总结</h2>
<p>这个博客写的内容都是些工程技巧实例方面的，看看就明白，有问题也可以通过邮件沟通。评论的使用成本最低，但其实效果并不好。有些东西还是要想想再说比较好。</p>
            </div>
            <div class="post_list">
              <div><span>Tags : </span>
                          <span><a href="https://www.ddkiss.com/tag/pelican.html">#pelican, </a></span>
                          <span><a href="https://www.ddkiss.com/tag/ping-lun.html">#评论, </a></span>
                          <span><a href="https://www.ddkiss.com/tag/comment.html">#comment, </a></span>
              </div>
            </div>
        </article>
        <div id="container"></div>
        <script type="text/javascript" src="//dn-coding-net-public-file.qbox.me/Coding-Comments/v0.1.0/gitment.min.js"></script>
        <script>
            var gitment = new Gitment({
              owner: 'whusl',
              repo: 'BlogComments',
              oauth: {
                client_id: '621866266817529fba46681653017809',
                client_secret: '14188411740b12ae52159cee9b586bf85cd54125',
              },
            })
            document.getElementById('container').appendChild(gitment.render())
          </script>
    </section>
</article>

<!-- Footer -->
    <footer>
        <p> &copy;2017-2020&nbsp;<a href="http://www.miitbeian.gov.cn/" target="_blank">鄂ICP备17020200号</a>
          Blog powered by <a href="http://getpelican.com/">Pelican</a>
        </p>
    </footer>

    <!-- Analytics -->
    <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?88c55edaf311dbacac56a16316b04c8b";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

<script type="text/javascript">(function(){document.write(unescape('%3Cdiv id="bdcs"%3E%3C/div%3E'));var bdcs = document.createElement('script');bdcs.type = 'text/javascript';bdcs.async = true;bdcs.src = 'http://znsv.baidu.com/customer_search/api/js?sid=14490611060029767912' + '&plate_url=' + encodeURIComponent(window.location.href) + '&t=' + Math.ceil(new Date()/3600000);var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(bdcs, s);})();</script>

</body>
</html>